package com.threeti.mecool.core.util;

import org.springframework.util.StringUtils;

/** 资源库常量 */
public abstract class ContentRepoConst {
	
	public static final String ILLEGAL_CONTENT_REPO_RESOURCE_ERROR_MSG = "内容仓库存在非法资源";
	/** 背景栏图片地址 */
	public static final String BACKGROUND_URL = "/Administration/Background/";
	/** 导航栏图片地址 */
	public static final String NAVIGATION_URL = "/Administration/Navigation/";
	/** 工具栏图片地址 */
	public static final String TOOL_URL = "/Administration/Tool/";
	/** skin缩略图图片地址 */
	public static final String SKIN_IMAGE_URL = "/Administration/SkinImage/";
	/** layout布局图片地址 */
	public static final String LAYOUT_IMAGE_URL = "/Administration/LayoutImage/";
	/** icon图标地址 */
	public static final String ICON_IMAGE_URL = "/Administration/IconImage/";
	/** Screenshot截图地址 */
	private static final String PACKAGE_SCREENSHOT = "/Administration/Screenshot/";
	/** 多媒体库 */
	public static final int RESOURCE_BRAND_MEDIA_REPO = 0;
	/** 标签库 */
	public static final int RESOURCE_BRAND_LABEL_REPO = 1;
	
	/** 品牌商杂项(除却多媒体库和标签库以外，如品牌商LOGO)) */
	public static final int RESOURCE_BRAND_MISC = 9;

	/** Screenshot截图地址 */
	public static String packageScreenshotPath(String name) {
		return PACKAGE_SCREENSHOT + RandomUtil.getRandomNameOf(name);
	}

	/** app图标地址 */
	public static String appIconURL(long appId, String imageName) {
		return "/App/" + appId + "/Icon/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** app应用图标地址 */
	public static String appFeatureIconURL(long appId, String imagePath) {
		return "/App/" + appId + "/FeatureIcon/" + RandomUtil.getRandomNameOf(ImageUtil.getImageSuffix(imagePath));
	}

	/** app启动项地址 */
	public static String appLoadingImageURL(long appId, String imageName) {
		return "/App/" + appId + "/LoadingImage/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** app应用首页地址 */
	public static String homeImageURL(long appId, String imageName) {
		return "/App/" + appId + "/HomeImage/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** app应用背景首页地址 */
	public static String backgroundImageURL(long appId, String imagePath) {
		String imageName = ImageUtil.getImageSuffix(imagePath);
		return "/App/" + appId + "/BackgroundImage/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** app截图地址 */
	public static String appScreenShotImageURL(long appId) {
		return "/App/" + appId + "/ScreenShotImage/" + RandomUtil.getRandomNameOf(appId + ".jpg");
	}

	/** app新闻内容地址 */
	public static String appNewsContentURL(long appId) {
		return "/App/" + appId + "/AppNews/Content/" + RandomUtil.getRandomNameOf(appId + ".txt");
	}

	/** app新闻图片地址 */
	public static String appNewsImageURL(long appId, String imageName, String imagePath) {
		if (!StringUtils.hasText(imageName)) {
			imageName = ImageUtil.getImageSuffix(imagePath);
		}
		return "/App/" + appId + "/AppNews/Image/" + RandomUtil.getRandomNameOf(imageName);
	}
	
	/** app新闻图片地址 */
	public static String appStoreImageURL(long appId, String imageName, String imagePath) {
		if (!StringUtils.hasText(imageName)) {
			imageName = ImageUtil.getImageSuffix(imagePath);
		}
		return "/App/" + appId + "/Store/Image/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** appFeatureCategory图片地址 */
	public static String appFeatureCategoryURL(long appId, String imageName, String imagePath) {
		if (imageName.equals("")) {
			imageName = ImageUtil.getImageSuffix(imagePath);
		}
		return "/App/" + appId + "/FeatureCategory/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** app画册图片地址 */
	public static String appImageURL(long appId, String imagePath) {
		String imageName = ImageUtil.getImageSuffix(imagePath);
		return "/App/" + appId + "/AppImage/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** app画册截图地址 */
	public static String appImageCropPictureURL(long appId) {
		return "/App/" + appId + "/AppImage/" + RandomUtil.getRandomNameOf(appId + ".jpg");
	}

	/** 画册图片标签地址 */
	public static String appImageLabelURL(long appId, String imageName, String imagePath) {
		if (!StringUtils.hasText(imageName)) {
			imageName = ImageUtil.getImageSuffix(imagePath);
		}
		return "/App/" + appId + "/AppImage/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** 画册视频地址 */
	public static String videoURL(long appId, String videoPath) {
		String videoName = ImageUtil.getImageSuffix(videoPath);
		return "/App/" + appId + "/AppVideo/" + RandomUtil.getRandomNameOf(videoName);
	}

	/** (品牌商)多媒体库地址 */
	public static String brandResourceURL(long brandId, String imageName, String imagePath) {
		if (imageName.equals("")) {
			imageName = ImageUtil.getImageSuffix(imagePath);
		}
		return "/Brand/" + brandId + "/Media/" + RandomUtil.getRandomNameOf(imageName);
	}

	/** (品牌商)标签库地址 */
	public static String brandResourceTagURL(long brandId, String imageName, String imagePath) {
		if (imageName.equals("")) {
			imageName = ImageUtil.getImageSuffix(imagePath);
		}
		return "/Brand/" + brandId + "/Label/" + RandomUtil.getRandomNameOf(imageName);
	}

	/**
	 * 会员头像存放路径
	 * */
	public static String memberImageURL(long appId, long memberId, String fileName) {
		return "/App/" + appId + "/Member/" + memberId + "/" + RandomUtil.getRandomNameOf(fileName);
	}

	/**
	 * brand品牌商图片地址
	 */
	public static String brandLogoURL(long brandId, String imageName) {
		return "/Brand/" + brandId + "/Logo/" + RandomUtil.getRandomNameOf(imageName);
	}

	/**
	 * 生成QR二维码随机图片地址
	 */
	public static String qrImageURL(long appId, long marketId) {
		return "/App/" + appId + "/QRImage/" + RandomUtil.getRandomNameOf("" + appId + marketId + ".jpg");
	}

	/**
	 * 生成本地上传的QR二维码图片地址
	 */
	public static String qrImageURL(long appId, String qrImageName) {
		return "/App/" + appId + "/QRImage/" + RandomUtil.getRandomNameOf(qrImageName);
	}
	
	/** 优惠券图片保存路径 */
	public static String couponURL(long appId, String imageName) {
		return String.format("/App/%d/Coupon/Image/%s", appId, RandomUtil.getRandomNameOf(imageName));
	}

	/** 礼品图片保存路径 */
	public static String giftURL(long appId, String imageName) {
		return String.format("/App/%d/Freegift/Image/%s", appId, RandomUtil.getRandomNameOf(imageName));
	}
	
	/**
	 * 每个品牌商对应的证书位置
	 */
	public static String mobileCertificationPath(long appId){
		
		return "/App/"+appId+"/Apptokens/" + appId + ".p12" ;
	}
	/**
	 *	I品城证书的位置 
	 */
	public static String ipinCityCertificationPath(){
		
		return "/App/Ipin/Apptokens/ipincity_brand.p12";
	}
	
}
